<template>
  <div>
    <el-dialog :title="formValue.id ? '编辑门店设置' : '新增门店设置'" :visible="visible" width="80%" @close="onClose" :close-on-click-modal="false">
      <el-form :model="formValue" :rules="formRules" ref="formRef" :class="$style.root">
        <el-row>
          <el-col :span="12">
            <el-form-item label="顶级渠道" :label-width="formLabelWidth" prop="topChannelCode">
              <el-select
                v-model="formValue.topChannelCode"
                placeholder="请选择"
                style="width: 80%"
                clearable
                :disabled="!!formValue.id"
                @change="topChannelChange"
              >
                <el-option v-for="item in topChannelList" :key="item.id" :label="item.name" :value="item.id" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="门店编码" :label-width="formLabelWidth" prop="storeCode">
              <el-input
                :disabled="!!formValue.id || !formValue.topChannelCode"
                v-model="formValue.storeCode"
                @blur="storeCodeBlur()"
                placeholder="门店编码"
                style="width: 80%"
                clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="渠道编码" :label-width="formLabelWidth" prop="channelCode">
              <el-input v-model="formValue.channelCode" placeholder="渠道编码" style="width: 80%" :disabled="true" clearable></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="门店名称" :label-width="formLabelWidth" prop="channelName">
              <el-input v-model="formValue.channelName" placeholder="门店名称" style="width: 80%" clearable :disabled="true"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="片区" :label-width="formLabelWidth" prop="districtCode">
              <el-input v-model="formValue.districtName" placeholder="片区" style="width: 80%" clearable :disabled="true"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="门店地址" :label-width="formLabelWidth" prop="address">
              <el-input v-model="formValue.address" placeholder="门店地址" type="textarea" style="width: 80%" rows="3" clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="处理类型" :label-width="formLabelWidth" prop="handleType">
              <el-select v-model="formValue.handleType">
                <el-option label="人工" value="MAN"></el-option>
                <el-option label="系统" value="SYS"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="门店类型" :label-width="formLabelWidth" prop="storeLevel">
              <el-select v-model="formValue.storeLevel" placeholder="请选择" style="width: 80%" clearable :disabled="formValue.id ? true : false">
                <el-option label="A" value="A" />
                <el-option label="B" value="B" />
                <el-option label="C" value="C" />
                <el-option label="D" value="D" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="所属蜂窝" :label-width="formLabelWidth" prop="cellularCode">
              <el-select clearable v-model="formValue.cellularCode" placeholder="请选择" style="width: 80%" filterable @change="cellularChange">
                <el-option v-for="item in cellulars" :key="item.cellularCode" :label="item.cellularName" :value="item.cellularCode" />
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
            <el-form-item label="门店类型" :label-width="formLabelWidth" prop="storeType">
              <el-select v-model="formValue.storeType" placeholder="请选择" style="width: 80%" clearable @change="storeTypeChange">
                <el-option label="重点门店" value="KEY_STORES" />
                <el-option label="非重点门店" value="NON_KEY_STORES" />
              </el-select>
            </el-form-item>
          </el-col> -->
        </el-row>
        <!-- <el-row>
          <el-col :span="12">
            <el-form-item label="门店优先级" :label-width="formLabelWidth" prop="storePriority">
              <el-select v-model="formValue.storePriority" placeholder="请选择" style="width: 80%" clearable>
                <el-option :label="item" :value="item" :key="item" v-for="item in storePriorityList" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row> -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="所在城市" :label-width="formLabelWidth" prop="storeName">
              <el-input v-model="formValue.city" style="width: 80%" placeholder="所在城市" clearable disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="城市运营经理" :label-width="formLabelWidth" prop="number">
              <el-input v-model="formValue.operationManagerNumber" style="width: 80%" placeholder="请输入工号" clearable></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" style="text-align: center">
        <el-button @click="onSubmit('formRef')" type="primary" :loading="onSubmitIng">确定</el-button>
        <el-button @click="onClose">取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<style lang="scss" module>
@import './index.module.scss';
</style>

<script>
import Index from './index';
export default Index;
</script>
